/*
 * Copyright [2025] [JinBooks of copyright http://www.jinbooks.com]
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
 

package com.jinbooks.entity;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jinbooks.util.JsonUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 系统参数实体类
 *
 * @author your-name
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@TableName("JBX_SYSTEM_PARAMETERS")
public class SystemParameters extends BaseEntity implements Serializable {
	
	@Serial
	private static final long serialVersionUID = 1L;

	@TableId(type = IdType.ASSIGN_ID)
	String id;

	/**
	 * 参数值
	 */
	String value;
	
	/**
	 * 参数描述
	 */
	String description;

	public <T> T jsonToBean(Class<T> cls) {
		return JsonUtils.parseObject(this.getValue(), cls);
	}

	public <T> List<T> jsonToBeanList(Class<T> cls) {
		// 注意：这里需要根据实际的JsonUtils工具类来实现数组转换逻辑
		// 暂时返回null，需要根据实际工具类实现
		return null;
	}
}